home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{0DE92B77-C272-11D1-82B4-E5132F8CF155}#8.0#0"; "csstray.ocx"
- Begin VB.Form frmEx1
- BorderStyle = 1 'Fixed Single
- Caption = "SysTray Example Application #1"
- ClientHeight = 5895
- ClientLeft = 150
- ClientTop = 435
- ClientWidth = 5535
- Icon = "frmEx1.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 5895
- ScaleWidth = 5535
- StartUpPosition = 1 'CenterOwner
- Begin csSysTrayCtl.csSysTray csSysTray2
- Left = 3000
- Top = 2280
- _ExtentX = 2064
- _ExtentY = 1111
- TrayIcon = "frmEx1.frx":0442
- TrayTip = "Look; a second icon!"
- TrayVisible = 0 'False
- p_RegCode = "frmEx1.frx":0894
- End
- Begin VB.CheckBox chkSecondIcon
- Caption = "Show another icon in the system tray!"
- Height = 255
- Left = 120
- TabIndex = 9
- Top = 5580
- Width = 3855
- End
- Begin VB.CheckBox chkShowIcon
- Caption = "Show the icon in the system tray."
- Height = 255
- Left = 120
- TabIndex = 8
- Top = 5340
- Width = 3855
- End
- Begin VB.TextBox txtTooltip
- Height = 345
- Left = 120
- TabIndex = 0
- Top = 4920
- Width = 3735
- End
- Begin csSysTrayCtl.csSysTray csSysTray1
- Left = 4200
- Top = 2280
- _ExtentX = 2064
- _ExtentY = 1111
- TrayIcon = "frmEx1.frx":08B4
- TrayTip = "SysTray Example Application #1"
- p_RegCode = "frmEx1.frx":0D06
- End
- Begin VB.CommandButton cmdClose
- Cancel = -1 'True
- Caption = "&Close"
- Default = -1 'True
- Height = 375
- Left = 4320
- TabIndex = 2
- Top = 5400
- Width = 1095
- End
- Begin VB.ListBox lstEvents
- Height = 2010
- Left = 120
- TabIndex = 1
- Top = 2520
- Width = 5295
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "Type the tooltip for the SysTray icon below:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 195
- Left = 120
- TabIndex = 7
- Top = 4680
- Width = 3735
- End
- Begin VB.Label Label5
- Caption = $"frmEx1.frx":0D26
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1125
- Left = 120
- TabIndex = 6
- Top = 1320
- Width = 5055
- End
- Begin VB.Label Label4
- Caption = $"frmEx1.frx":0E31
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 665
- Left = 120
- TabIndex = 5
- Top = 600
- Width = 5055
- End
- Begin VB.Label Label3
- Caption = "This example application shows just how easy it is to use the SysTray control in your own application."
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 120
- TabIndex = 4
- Top = 120
- Width = 5055
- End
- Begin VB.Label Label2
- Caption = "^^ EVENTS ^^"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 4080
- TabIndex = 3
- Top = 4680
- Width = 1335
- End
- Begin VB.Menu mnuSysTray
- Caption = "SysTray"
- Visible = 0 'False
- Begin VB.Menu mnuSysTrayAbout
- Caption = "&About SysTray"
- End
- Begin VB.Menu mnuSysTraySep
- Caption = "-"
- End
- Begin VB.Menu mnuSysTrayClose
- Caption = "&Close Program"
- End
- End
- Attribute VB_Name = "frmEx1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- 'Example program for SysTray Control
- '(C) Copyright 1998 Charon Software, All Rights Reserved
- 'You may use or modify this code in any way you see fit.
- 'Charon Software takes no responsibility for what you may
- 'do with this or any modification of this code.
- Private Sub chkSecondIcon_Click()
- 'if the user clicks on this checkbox, toggle the visible
- 'property of the system tray icon.
- csSysTray2.TrayVisible = chkSecondIcon.Value
- End Sub
- Private Sub chkShowIcon_Click()
- 'if the user clicks on this checkbox, toggle the visible
- 'property of the system tray icon.
- csSysTray1.TrayVisible = chkShowIcon.Value
- End Sub
- Private Sub cmdClose_Click()
- 'pretty self-explanatory; just unload the form. The system
- 'tray icons will go away automatically!
- Unload Me
- End Sub
- Private Sub csSysTray1_Click()
- 'for this example, we report the event in a listbox.
- lstEvents.AddItem "Event: Click"
- lstEvents.ListIndex = lstEvents.ListCount - 1
- End Sub
- Private Sub csSysTray1_DblClick()
- 'for this example, we report the event in a listbox.
- lstEvents.AddItem "Event: DblClick"
- lstEvents.ListIndex = lstEvents.ListCount - 1
- End Sub
- Private Sub csSysTray1_MiddleClick()
- 'for this example, we report the event in a listbox.
- lstEvents.AddItem "Event: MiddleClick"
- lstEvents.ListIndex = lstEvents.ListCount - 1
- End Sub
- Private Sub csSysTray1_MiddleDblClick()
- 'for this example, we report the event in a listbox.
- lstEvents.AddItem "Event: MiddleDblClick"
- lstEvents.ListIndex = lstEvents.ListCount - 1
- End Sub
- Private Sub csSysTray1_MouseDown(Button As Integer)
- 'for this example, we report the event in a listbox.
- lstEvents.AddItem "Event: MouseDown, Button:" + Str(Button)
- lstEvents.ListIndex = lstEvents.ListCount - 1
- End Sub
- Private Sub csSysTray1_MouseMove()
- 'for this example, we report the event in a listbox.
- lstEvents.AddItem "Event: MouseMove"
- lstEvents.ListIndex = lstEvents.ListCount - 1
- End Sub
- Private Sub csSysTray1_MouseUp(Button As Integer)
- 'for this example, we report the event in a listbox.
- lstEvents.AddItem "Event: MouseUp, Button:" + Str(Button)
- lstEvents.ListIndex = lstEvents.ListCount - 1
- End Sub
- Private Sub csSysTray1_RightClick()
- 'for this example, we report the event in a listbox.
- lstEvents.AddItem "Event: RightClick"
- lstEvents.ListIndex = lstEvents.ListCount - 1
- 'since the user right-clicked the icon, pop up a menu!
- 'the vbPopupMenuRightButton flag allows both our right and
- 'left mouse buttons to be able to choose menu items, instead
- 'of just the left button.
- 'note that we use the SysTray's PopupMenu method. Using this
- 'method will ensure that our popup menu goes away when it should.
- csSysTray1.PopupMenu mnuSysTray, vbPopupMenuRightButton
- 'you could also add the "default" menu item as the last parameter
- 'in PopUpMenu. That would indicate that single left-clicking the
- 'icon would do the same thing. It's not included here because
- 'double left-clicking just shows your mouse events instead.
- 'To do this, you would use a command like the following:
- ' csSysTray1.PopupMenu mnuSysTray, vbPopupMenuRightButton, , , mnuSysTrayAbout
- End Sub
- Private Sub csSysTray1_RightDblClick()
- 'for this example, we report the event in a listbox.
- lstEvents.AddItem "Event: RightDblClick"
- lstEvents.ListIndex = lstEvents.ListCount - 1
- End Sub
- Private Sub Form_Load()
- 'here, we do some initializion. We set the text of
- 'of our textbox to the current tooltip of the system
- 'tray icon. We also set the checked properties of our
- 'checkboxes to the appropriate values.
- txtTooltip.Text = csSysTray1.TrayTip
- If csSysTray1.TrayVisible = True Then
- chkShowIcon.Value = vbChecked
- Else
- chkShowIcon.Value = vbUnchecked
- End If
- If csSysTray2.TrayVisible = True Then
- chkSecondIcon.Value = vbChecked
- Else
- chkSecondIcon.Value = vbUnchecked
- End If
- txtTooltip.SelStart = Len(txtTooltip.Text)
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- csSysTray1.ZoomToTray Me.hWnd
- End Sub
- Private Sub Label5_Click()
- End Sub
- Private Sub mnuSysTrayAbout_Click()
- csSysTray1.AboutBox
- End Sub
- Private Sub mnuSysTrayClose_Click()
- 'simple enough: close down our program.
- Unload Me
- End Sub
- Private Sub txtTooltip_Change()
- 'change the tooltip on the system tray icon.
- csSysTray1.TrayTip = txtTooltip.Text
- End Sub
-